<template>
  <el-dialog v-model="isShow" title="公告信息" width="50%" align-center draggable>
    <h3>公告涉及区域与物业电话</h3>
    <el-table :data="noticeScope" stripe border>
      <el-table-column prop="name" label="区域名称" />
      <el-table-column prop="tel" label="物业电话" />
    </el-table>
    <el-form :model="notice" class="demo-form-inline">
      <el-form-item label="公告标题：">
        <el-input v-model="notice.title" placeholder="请输入公告标题" />
      </el-form-item>
      <el-form-item label="公告内容：">
        <el-input
          v-model="notice.content"
          :autosize="{ minRows: 5, maxRows: 5 }"
          type="textarea"
          placeholder="请输入公告内容"
        />
      </el-form-item>
      <el-form-item label="发布单位：">
        <el-select v-model="notice.unit" placeholder="请选择单位名称">
          <el-option v-for="item of units" :key="item" :label="item" :value="item" />
        </el-select>
      </el-form-item>
    </el-form>
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="isShow = false">关闭</el-button>
        <el-button type="primary" @click="handleSub">发布</el-button>
      </span>
    </template>
  </el-dialog>
</template>

<script setup>
import { useNotice } from './Hooks/useNotice'
const { isShow, noticeScope, notice, units, handleSub } = useNotice()
</script>

<style scoped>
.el-form {
  margin-top: 20px;
}
</style>
